<template>
  <div class="pinpai">
    <van-nav-bar
      title="品牌制造商"
      left-text="返回"
      fixed
      left-arrow
      @click-left="$router.back()"
    />
    <!-- 大banner图1 -->
    <div class="banner">
      <img :src="ban.app_list_pic_url" alt="" />
      <p>{{ ban.name }}</p>
    </div>
    <!-- 介绍 -->
    <div class="jieshao">
      <p>{{ ban.simple_desc }}</p>
    </div>
    <!-- 商品展示 -->
    <div class="show">
      <ul>
        <li
          @click="$router.push(`/goumai?id=${item.id}`)"
          v-for="item in list"
          :key="item.id"
        >
          <img :src="item.list_pic_url" alt="" />
          <h3>{{ item.name }}</h3>
          <p>￥{{ item.retail_price }}</p>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { detailaction } from "@/api/品牌制造商/pinpai.js";
export default {
  name: "Pinpai",
  data() {
    return {
      // 大banner图
      ban: {},
      // 商品列表
      list: [],
    };
  },
  created() {
    console.log(this.$route.query.id);
    detailaction({
      params: {
        id: this.$route.query.id,
      },
    }).then((res) => {
      console.log(res);
      this.ban = res.data.data;
      this.list = res.data.goodsList;
    });
  },
};
</script>

<style lang="less" scoped>
.pinpai {
  .banner {
    position: relative;
    margin-top: 50px;
    width: 100%;
    height: 160px;
    img {
      width: 100%;
      height: 100%;
    }
    p {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      color: black;
      font-size: 16px;
      border-bottom: 3px solid rgb(241, 241, 241);
    }
  }
  .jieshao {
    background: #fff;
    padding: 0.56rem 0.42667rem;
    font-size: 0.4rem;
    color: #666;
    text-align: center;
    margin-bottom: 10px;
  }
  .show {
    ul {
      list-style: none;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      align-content: center;
      li {
        width: 49%;
        height: 230px;
        margin-bottom: 5px;
        text-align: center;
        img {
          width: 100%;
          height: 70%;
        }
        h3 {
          margin: 5px 0;
        }
        p {
          color: red;
          font-size: 13px;
          margin: 5px 0;
        }
      }
    }
  }
}
</style>